package com.ibm.wd150.ticketing;

import java.util.ArrayList;

import com.ibm.wd150.utilities.SeatReserver;

public class SeatingPlan {
	private ArrayList<Seat> seats;

	// private int numSeatsPerRow = 0;
	// private int numRows = 0;
	// private int numBusRows = 0;
	private SeatReserver seatReserver;
	private int totalRows = 0;
	private static String seatLetters = "ABCDEFGHJK";

	public ArrayList<Seat> getSeats() {
		return seats;
	}

	public SeatReserver getSeatReserver() {
		return seatReserver;
	}

	public SeatingPlan() {
		seats = new ArrayList<Seat>();
		Seat seat;
		for (SeatingClass sClass : SeatingClass.values()) {
			for (int r = 0; r < sClass.getRows(); r++) {
				totalRows++;
				for (int s = 0; s < sClass.getSeatsAcross(); s++) {
					seat = new Seat();
					seat.setRow(totalRows);
					seat.setLetter(seatLetters.charAt(s));
					seats.add(seat);
				}
			}
		}
		System.out.println("Seating plan has " + SeatingClass.getTotalSeats()
				+ " seats.");
		seatReserver = new SeatReserver(this);
	}

	public int getTotalSeats() {
		return SeatingClass.getTotalSeats();
	}
}
